package queue

import (
	"github.com/beeker1121/goque"
	"fmt"
)

func EnqueueObject(path string,object interface{})  {
	s, err := goque.OpenQueue(path)
	if err!=nil{
		//log
		return
	}
	defer s.Close()
	s.EnqueueObject(object)
}
func EnqueueString(path string,object string)  {
	s, err := goque.OpenQueue(path)
	if err!=nil{
		//log
		return
	}
	defer s.Close()
	s.EnqueueString(object)
}
func Dequeue(path string) *goque.Item {

	s, err := goque.OpenQueue(path)
	if err!=nil{
		//log
		fmt.Println(err)
		return nil
	}
	defer s.Close()

	item,err:= s.Dequeue()

	if err!=nil{
		//log
		fmt.Println(err)
		return nil
	}

	return item
}
